﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using QuanLyTruongHoc_App.MyDataSet;

namespace QuanLyTruongHoc_App
{
    public partial class LogInForm : Form
    {
        public delegate void EventUpdate(object sender, string _username);
        public event EventUpdate LogIn;

        public LogInForm()
        {
            InitializeComponent();
            lg_LogIn.LogIn += new QuanLyTruongHoc_App.MyControls.LogInControl.EventUpdate(lg_LogIn_LogIn);
        }

        private void lg_LogIn_LogIn(Object sender)
        {
            if (PublicLib.checkLogin(lg_LogIn.Username, lg_LogIn.Password))
            {
                LogIn(this, lg_LogIn.Username);
                this.Close();
            }
            else
            {
                MessageBox.Show(MSG.MSG_LOGIN_FAILE);
                lg_LogIn.Focus();
            }
        }
    }
}
